﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<OurSite.Web.Models.EventModel> " %>
<%@ Import Namespace="OurSite.Business.Picture"%>
<%@ Import Namespace="OurSite.Business.Event"%>
<%@ Import Namespace="OurSite.Business.Video"%>
<%@ Import Namespace="OurSite.Web.HTMLHelpers" %>

<script>
    $(document).ready(function() {
        // Activate fancybox image popup
        $(".gallery-item a").fancybox();

        $(".video").click(
            function() 
            {
                jQuery.fancybox(
                {
                    'autoScale': false,
                    'width': 853,
                    'height': 510,
                    'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
                    'type': 'swf',
                    'swf':
                    {
                        'allowfullscreen': 'true'
                    }
                });

                return false;
            });
    });

</script>
		            
<section id="level4">				
    <header> 
	    <h1><%=Html.Encode(Model.Event.Name)%></h1> 
	    
	    <%if (Model.Event.StartDate != DateTime.MinValue) {%>
	        <h2>Date:</h2> <%=Html.Encode(Model.Event.DateRange)%> <br />
	    <% }%>    
	        
	    <%if(!string.IsNullOrEmpty(Model.Event.FullLocation)) %>    
	        <h2>Location:</h2> <%= Html.Encode(Model.Event.FullLocation)%>
    </header> 
    <article> 
   	        <%foreach (Picture picture in Model.Event.Pictures) { %>
    	        
    	        <div class="gallery-item">
                    <a rel="related_group" class="galleryThumb galleryThumbImage" href="<%= Model.Prefix + picture.ImagePath %>" title="<b><%= picture.ParentEvent.FullLocation + "</b><br/> " + picture.Caption.Replace("\"", @"''") %>">
                        <i style="background-image: url('<%= Model.Prefix + "Small" + picture.ImagePath %>')"></i>
                    </a>
                </div>

    	<%  } %>
    	
    </article>
</section>
<% Html.RenderAction("PhotoMenu", "Photos"); %>

<% if (Model.Event.Videos.Count > 0) { %>
    <section id="video">
        <h2>Videos</h2>
        <article>
            <%foreach (Video video in Model.Event.Videos) { %>
	        
	            <div class="video-item">
                    <a rel="video_group" class="video videoThumb videoThumbImage" href="http://www.youtube.com/watch?v=<%= video.YoutubeId %>?fs=1&autoplay=1" title="<%= video.Caption %>">
                        <i style="background-image: url('http://i1.ytimg.com/vi/<%= video.YoutubeId %>/0.jpg')"></i>
                    </a>
                </div>

	        <%  } %>
        
        </article>
    </section>

<%} %>
    


<div class="clear"></div>